{extend name="common@base/common" /} {block name="body"}
<style>
    tbody td {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    
    .search-input.date {
        height: 30px;
    }
    
    #contents {
        padding-top: .1px;
    }
</style>
<div class="span9 page_message">
    <section id="contents">
        {include file="common@base/_nav" /} {if condition="$add_button || $del_button || $search_button || !empty($top_more_button)|| !empty($muti_search)"}
        <div class="table-bar">
            <div class="fl">
                {empty name="model.extend"}
                <div class="tools" style="margin-bottom: 10px">
                    {if condition="$add_button"}{php} isset($add_url) || $add_url = U('add?model='.$model['id'], $get_param);{/php}<a class="btn" href="{$add_url}">新 增</a>{/if} {if condition="$del_button"}{php} isset($del_url) || $del_url = U('del?model='.$model['id'],
                    $get_param);{/php}
                    <button class="btn ajax-post confirm" target-form="ids" url="{$del_url}">删 除</button>{/if} {volist name="top_more_button" id="vo"} {notempty name="$vo['is_buttion']"}
                    <button class="btn {$vo.class}" target-form="ids" url="{$vo.url}">{$vo.title}</button> {else/}
                    <a class="btn" href="{$vo.url}">{$vo.title}</a> {/notempty} &nbsp; {/volist}
                </div>
                {/empty}
            </div>
            <!-- 高级搜索 -->
            {if condition="$search_button"}
            <div class="search-form fr cf">
                <div class="sleft">
                    {php}empty($search_key) && $search_key=$model['search_key'];empty($search_key) && $search_key='title';unset($get_param[$search_key]);empty($placeholder) && $placeholder='请输入内容搜索';{/php} {php} isset($model['name']) && $get_param['model']=$model['name'];
                    isset($search_url) || $search_url = U(MODULE_NAME.'/'.CONTROLLER_NAME.'/lists', $get_param);{/php}
                    <input type="text" name="{$search_key}" class="search-input" value="{:input($search_key)}" placeholder="{$placeholder}">
                    <a class="sch-btn" href="javascript:;" id="search" url="{$search_url}"><i class="btn-search"></i></a> </div>
            </div>
            {/if}
            <!-- 多维过滤 -->
            {notempty name="muti_search"}
            <form class="muti_search cf" action="{$search_url|default=''}" method="get">
                <div style="line-height: 30px;">
                    {volist name='muti_search' id='vo'} {switch name="vo.type"} {case value="select"}
                    <span>{$vo.title}：</span>
                    <select name="{$vo.name}" class="search-input input-small">
                    {volist name='vo.options' id='option'}
                    <option value="{$option.value}" {eq name='option.default_value' value='option.value'}selected{/eq} >{$option.title}</option>
                    {/volist}                    
                    </select> {/case} {case value="datetime"}
                    <span>{$vo.title}：</span>
                    <input type="datetime" autocomplete="off" name="start_time" class="search-input date input-small" value="{$vo.start_time}" placeholder="请选择时间">
                    <span>至</span>
                    <input type="datetime" autocomplete="off" name="end_time" class="search-input date input-small" value="{$vo.end_time}" placeholder="请选择时间"> {/case} {case value="checkbox"}
                    <span>{$vo.title}：</span> {volist name='vo.options' id='option'}
                    <input autocomplete="off" type="checkbox" name="{$option.name}" value="{$option.value}" {eq name='option.default_value' value='option.value' }checked{/eq}>{$option.title} {/volist} {/case} {case value="radio"}
                    <span>{$vo.title}：</span> {volist name='vo.options' id='option'}
                    <input type="radio" name="{$option.name}" value="{$option.value}" {eq name='option.default_value' value='option.value' }checked{/eq}>{$option.title} {/volist} {/case} {/switch} {/volist}

                    <!-- <a class="sort " href="#" title="排序">排序:高->低</a> -->
                    <button type="button" class="sch-btn btn" href="javascript:;" id="muti_search" style="padding: 6px;">搜索</button> </div>
            </form>
            {/notempty}
        </div>
        {/if}
        <!-- 数据列表 -->
        {php}$now_by = I('by','asc'); if($now_by=='asc'){ $next_by = 'desc'; $by_icon = '<i class="sort_up"></i>'; } else { $next_by = 'asc'; $by_icon = '<i class="sort_down"></i>'; }{/php}
        <div class="data-table">
            <div class="table-striped">
                <table cellspacing="1" style="table-layout: fixed">
                    <!-- 表头 -->
                    <thead>
                        <tr>
                            {if condition="$check_all"}
                            <th style="width: 40px" class="row-selected row-selected"> <input autocomplete="off" type="checkbox" id="checkAll" class="check-all regular-checkbox"><label for="checkAll"></label></th>{/if} {notempty name="$list_grids"} {volist name="list_grids" id="field"}
                            <th {notempty name="field.width" }width="{$field.width}%" {/notempty}>
                                {notempty name="field.is_sort"} {php} $get_param['order'] = $field['name']; $get_param['by'] = $next_by; $show_by = ''; $now_order = I('order'); if($now_order==$field['name']){ $show_by = $by_icon; } $order_url = U(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME,
                                $get_param); {/php}
                                <a href="{$order_url}" class="desc">{$field.title} {$show_by|raw}</a> {else /} {$field.title} {/notempty}
                            </th>
                            {/volist}{/notempty}
                        </tr>
                    </thead>

                    <!-- 列表 -->
                    <tbody>
                        {notempty name="$list_data"} {volist name="list_data" id="data"}
                        <tr>
                            {if condition="$check_all"}
                            <td><input autocomplete="off" class="ids regular-checkbox" type="checkbox" value="{$data['id']}" name="ids[]" id="check_{$data['id']}"><label for="check_{$data['id']}"></label></td>{/if} {volist name="list_grids" id="grid"} 
                            {if condition="(isset($grid.raw) && $grid.raw == 1) OR (isset($grid.come_from) && $grid.come_from == 1)" }
                            <td style="overflow: auto;white-space: normal ">{$data[$key]|raw}</td>{else /}
                            <td title="{$data[$key]}">{$data[$key]|raw}</td>{/if} {/volist}
                        </tr>
                        {/volist}{/notempty}
                    </tbody>
                </table>
            </div>
        </div>
        <div class="page"> {$_page|raw|default=''} </div>
    </section>
</div>
{/block} {block name="script"}
<link href="__STATIC__/datetimepicker/css/datetimepicker.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css"> {php}if(config('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css"> ';{/php}
<link href="__STATIC__/datetimepicker/css/dropdown.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js?v={:SITE_VERSION}" charset="UTF-8"></script>

<script type="text/javascript">
    $(function() {
        var url = window.location.href;
        if (url.indexOf("/news/lists") != -1) {
            $('.admin-body').css({
                'margin-left': '1.5em',
                'margin-right': '0',
            })
            $('#contents').css('padding-top', '1em')
        }
        $('.time').datetimepicker({
            format: 'yyyy-mm-dd hh:ii',
            language: "zh-CN",
            minView: 0,
            autoclose: true
        });
        $('.date').datetimepicker({
            format: 'yyyy-mm-dd',
            language: "zh-CN",
            minView: 2,
            autoclose: true
        });
        //搜索功能
        $("#search").click(function() {
            var url = $(this).attr('url');
            var str = $('.search-input').val()
            var query = $('.search-input').attr('name') + '=' + str.replace(/(^\s*)|(\s*$)/g, "");

            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            url = change_search_url(url);
            window.location.href = url;
        });

        //回车自动提交
        $('.search-form').find('input').keyup(function(event) {
            if (event.keyCode === 13) {
                $("#search").click();
            }
        });

        $("#muti_search").click(function() {
            var url = $(".muti_search").attr('action');
            var data = $(".muti_search").serialize();
            if (url.indexOf('?') > 0) {
                url += '&' + data;
            } else {
                url += '?' + data;
            }
            url = change_search_url(url);
            window.location.href = url;
        });
    })
</script>
{/block}